void babl_store_db (void);
int _babl_max_path_len (void);
-double babl_trc_from_linear (const Babl *trc, double value);
-double babl_trc_to_linear (const Babl *trc, double value);
-float babl_trc_from_linearf (const Babl *trc, float value);
-float babl_trc_to_linearf (const Babl *trc, float value);
const Babl *
babl_trc_new (const char *name,
*
* Makes linear data non-linear according to the trc.
*/
-double babl_trc_from_linear (const Babl *trc, double value);
+float babl_trc_from_linear (const Babl *trc, float value);
/**
* babl_trc_from_linear:
*
* Makes non-linear data with the TRC linear data.
*/
-double babl_trc_to_linear (const Babl *trc, double value);
+float babl_trc_to_linear (const Babl *trc, float value);
-/**
- * babl_trc_from_linearf:
- *
- * Makes linear data non-linear according to the trc, single precision float,
- * a little bit faster than the double version.
- */
-float babl_trc_from_linearf (const Babl *trc, float value);
-
-/**
- * babl_trc_from_linearf:
- *
- * Makes non-linear data with the TRC linear data, single precision float
- * alittle bit faster than the double version.
- */
-float babl_trc_to_linearf (const Babl *trc, float value);
void babl_space_to_xyz (const Babl *space, const double *rgb, double *xyz);
void babl_space_from_xyz (const Babl *space, const double *xyz, double *rgb);
switch (trc_db[i].type)
{
case BABL_TRC_LINEAR:
- trc_db[i].fun_to_linear = _babl_trc_linearf;
- trc_db[i].fun_from_linear = _babl_trc_linearf;
+ trc_db[i].fun_to_linear = _babl_trc_linear;
+ trc_db[i].fun_from_linear = _babl_trc_linear;
break;
case BABL_TRC_GAMMA:
- trc_db[i].fun_to_linear = _babl_trc_gamma_to_linearf;
- trc_db[i].fun_from_linear = _babl_trc_gamma_from_linearf;
+ trc_db[i].fun_to_linear = _babl_trc_gamma_to_linear;
+ trc_db[i].fun_from_linear = _babl_trc_gamma_from_linear;
break;
case BABL_TRC_SRGB:
- trc_db[i].fun_to_linear = _babl_trc_srgb_to_linearf;
- trc_db[i].fun_from_linear = _babl_trc_srgb_from_linearf;
+ trc_db[i].fun_to_linear = _babl_trc_srgb_to_linear;
+ trc_db[i].fun_from_linear = _babl_trc_srgb_from_linear;
break;
case BABL_TRC_LUT:
- trc_db[i].fun_to_linear = babl_trc_lut_to_linearf;
- trc_db[i].fun_from_linear = babl_trc_lut_from_linearf;
+ trc_db[i].fun_to_linear = babl_trc_lut_to_linear;
+ trc_db[i].fun_from_linear = babl_trc_lut_from_linear;
break;
}
return (Babl*)&trc_db[i];
babl_trc_new ("linear", BABL_TRC_LINEAR, 1.0, 0, NULL);
}
-double babl_trc_from_linear (const Babl *trc_, double value)
+float babl_trc_from_linear (const Babl *trc_, float value)
{
return _babl_trc_from_linear (trc_, value);
}
-double babl_trc_to_linear (const Babl *trc_, double value)
+float babl_trc_to_linear (const Babl *trc_, float value)
{
return _babl_trc_to_linear (trc_, value);
}
-float babl_trc_from_linearf (const Babl *trc_, float value)
-{
- return _babl_trc_from_linearf (trc_, value);
-}
-
-float babl_trc_to_linearf (const Babl *trc_, float value)
-{
- return _babl_trc_to_linearf (trc_, value);
-}
-
const Babl *babl_trc_lut_find (float *lut, int lut_size)
{
int i;
} BablTRC;
-static inline float babl_trc_lut_from_linearf (const Babl *trc_, float value)
+static inline float babl_trc_lut_from_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
int entry = value * trc->lut_size + 0.5;
return ret;
}
-static inline float babl_trc_lut_to_linearf (const Babl *trc_, float value)
+static inline float babl_trc_lut_to_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
int entry = value * trc->lut_size + 0.5;
return ret;
}
-static inline double babl_trc_lut_from_linear (const Babl *trc_, double value)
-{
- BablTRC *trc = (void*)trc_;
- int entry = value * trc->lut_size + 0.5;
- double ret = trc->inv_lut[
- (entry >= 0 && entry < trc->lut_size) ?
- entry :
- trc->lut_size-1];
- /* XXX: fixme, do linear interpolation */
- return ret;
-}
-
-static inline double babl_trc_lut_to_linear (const Babl *trc_, double value)
-{
- BablTRC *trc = (void*)trc_;
- int entry = value * trc->lut_size + 0.5;
- double ret = trc->lut[
- (entry >= 0 && entry < trc->lut_size) ?
- entry :
- trc->lut_size-1];
- /* XXX: fixme, do linear interpolation */
- return ret;
-}
-
-static inline double _babl_trc_from_linear (const Babl *trc_, double value)
-{
- BablTRC *trc = (void*)trc_;
- switch (trc->type)
- {
- case BABL_TRC_LINEAR: return value;
- case BABL_TRC_GAMMA: return pow (value, 1.0/trc->gamma);
- case BABL_TRC_SRGB: return babl_linear_to_gamma_2_2 (value);
- case BABL_TRC_LUT: return babl_trc_lut_from_linear (trc_, value);
- }
- return value;
-}
-
-static inline double _babl_trc_to_linear (const Babl *trc_, double value)
-{
- BablTRC *trc = (void*)trc_;
- switch (trc->type)
- {
- case BABL_TRC_LINEAR: return value;
- case BABL_TRC_GAMMA: return pow (value, trc->gamma);
- case BABL_TRC_SRGB: return babl_gamma_2_2_to_linear (value);
- case BABL_TRC_LUT: return babl_trc_lut_to_linear (trc_, value);
- }
- return value;
-}
-
-static inline float _babl_trc_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_linear (const Babl *trc_, float value)
{
return 1.0;
}
-static inline float _babl_trc_gamma_to_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_gamma_to_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
return powf (value, trc->gamma);
}
-static inline float _babl_trc_gamma_from_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_gamma_from_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
return powf (value, 1.0f/trc->gamma);
}
-static inline float _babl_trc_srgb_to_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_srgb_to_linear (const Babl *trc_, float value)
{
- return babl_gamma_2_2_to_linearf (value);
+ return babl_gamma_2_2_to_linear (value);
}
-static inline float _babl_trc_srgb_from_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_srgb_from_linear (const Babl *trc_, float value)
{
return babl_linear_to_gamma_2_2f (value);
}
-static inline float _babl_trc_from_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_from_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
return trc->fun_from_linear (trc_, value);
}
-static inline float _babl_trc_to_linearf (const Babl *trc_, float value)
+static inline float _babl_trc_to_linear (const Babl *trc_, float value)
{
BablTRC *trc = (void*)trc_;
return trc->fun_to_linear (trc_, value);